package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JLabel;

import model.Call;
import model.Model;
import view.items.PanelBottomChat;
import view.items.PanelBottomInfoCall;
import view.items.PanelTitre;
import controller.Controller;



public class ViewBottom extends javax.swing.JPanel {


	private int width;
	private int height;
	private PanelBottomInfoCall panelBottomInfoCall;
	private PanelBottomChat panelBottomChat;
	
	
	public ViewBottom(Controller controller, int x, int y, int width, int height) {
		this.width=width;
		this.height=height;
		this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 1));
		this.setBackground(Color.lightGray);
		this.setBounds(x,y,width,height);
		//this.setLayout(new GridLayout(2, 2));
		
		PanelTitre labelTitre = new PanelTitre("Call info + Chat");
		labelTitre.setPreferredSize(new Dimension(width,30));
		this.add(labelTitre);
		
		panelBottomInfoCall = new PanelBottomInfoCall(controller);
		panelBottomInfoCall.setPreferredSize(new Dimension(width/2, height-30));
		panelBottomChat = new PanelBottomChat(controller);
		panelBottomChat.setPreferredSize(new Dimension(width/2, height-30));
		
		this.add(panelBottomInfoCall);
		this.add(panelBottomChat);
		
		this.refresh();
	}

	public void refresh() {
		
		//System.out.println("refresh infozone");
		this.panelBottomInfoCall.refresh();
		this.panelBottomChat.refresh();
		this.repaint();
		this.revalidate();
		
		
		
	}

	public PanelBottomChat getPanelBottomChat() {
		return panelBottomChat;
	}

	public PanelBottomInfoCall getPanelBottomInfoCall() {
		return panelBottomInfoCall;
	}
}
